package com.sf.fy.uav.order.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sf.fy.uav.common.request.order.AnswerFeedbackRequest;
import com.sf.fy.uav.common.request.order.CloseFeedbackRequest;
import com.sf.fy.uav.common.request.order.FeedbackRequest;
import com.sf.fy.uav.common.request.order.SysFeedbackRequest;
import com.sf.fy.uav.common.response.order.SysFeedbackResponse;
import com.sf.fy.uav.order.entity.Feedback;
import com.sf.fy.uav.order.service.IFeedbackService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 反馈 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2023-06-09
 */
@RestController
@RequestMapping("/sys/feedback")
public class FeedbackRest {

    @Autowired
    private IFeedbackService iFeedbackService;

    /**
     * 添加反馈数据
     */
    @PostMapping("add")
    @Operation(tags = "添加反馈", description = "添加反馈")
    public Feedback add(@RequestBody FeedbackRequest feedbackRequest) {
        return iFeedbackService.add(feedbackRequest);
    }

    public Long getTotal(@RequestParam(required = false) String orderId,
                         @RequestParam(required = false) String workOrderNum, @RequestParam(required = false) Integer status, @RequestParam(required = false) String feedbackTypeName,
                         @RequestParam(required = false) Integer platformCode) {
        return iFeedbackService.getTotal(orderId, workOrderNum, status, feedbackTypeName, platformCode);
    }

    public List<SysFeedbackResponse> getFeedbacks(SysFeedbackRequest sysFeedbackRequest) {
        return iFeedbackService.getFeedbacks(sysFeedbackRequest);
    }

    public void answer(AnswerFeedbackRequest answerFeedbackRequest) {
        iFeedbackService.answer(answerFeedbackRequest);
    }

    public void close(CloseFeedbackRequest closeFeedbackRequest) {
        iFeedbackService.close(closeFeedbackRequest);
    }

    public Page<Feedback> selectPageListByUserId(Integer page,Integer size,String userId) {
        return iFeedbackService.selectPageListByUserId(page,size,userId);
    }


}
